Display prefix names in terminal-mode
authorChris Perkins <chrisperkins99@gmail.com>
Sat, 28 Nov 2015 18:15:21 +0000 (11:15 -0700)
committerChris Perkins <chrisperkins99@gmail.com>
Sat, 28 Nov 2015 18:15:21 +0000 (11:15 -0700)
commitead6b70fd0910ead6db01ac8762918f48b6a5e5c
tree90dfc7d3e98641132c18adde1a7ec7de346f27cf
parent2d0b1463adabedf679efa8257ff1cb3555808cf1
Display prefix names in terminal-mode

When running emacs in a terminal (or at least, in iTerm), keys are not
passed through to emacs the same way that they are in graphical mode.

For example, M-m (important in spacemacs) is the key-sequence
`[134217837]` in graphical emacs, but `[27 109]` ("ESC m") in terminal.

The variable `which-key-prefix-name-alst` only has a mapping for the
former (the 134217837), and so the names of submenus all show up as
"+prefix", limiting discoverability.

This commit converts the key sequence into a canonical form (eg:
converts `[27 109]` into `[134217837]`) in
`which-key--maybe-replace-prefix-name`, so that the prefixes are found.

I think some work is probably needed for
`which-key-prefix-title-alist` too, but I'm not entirely sure what
that's used for, so I didn't mess with it.
which-key.el